import React,{Component} from 'react';
import {connect} from 'react-redux';
import actions from '../../../../store/actions/home';

class UserList extends Component{
	static loadData=() => {
		console.log('加载数据');
	}
	//componentDidMount在服务器端是不执行的
	componentDidMount() {
		this.props.getHomeList();
	}
	render() {
		return (
			<ul className="list-group">
				{
					this.props.list.map(item => (
						<li className="list-group-item" key={item.id}>{item.name}</li>
					))
				}
			</ul>
		)
	}
}
export default connect(
	state => state.home,
	actions
)(UserList);